﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Airborne.ScrumPoker.Module.Converters
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Colour", Justification="Damn americans!")]
    public class ColourTimerConverter : IValueConverter
    {
        #region IValueConverter Members

        public static readonly string DefaultBlue = "#30C2FF";
        public static readonly string WarningOrange = "#ffa800";
        public static readonly string CriticalRed = "#db2453";
        

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int count = int.Parse(value.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture);
           
          
            if (count < 20)
            {
                return CriticalRed;
            }

            if (count < 35)
            {
                return WarningOrange;
            }

            return DefaultBlue;  
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
